cmake_minimum_required(VERSION 3.5.1)


add_library(planning_lattice_trajectory1d 
            lattice_trajectory1d.cc)
target_link_libraries(planning_lattice_trajectory1d
    cyber::common
    planning::curve1d)
add_library(planning::lattice_trajectory1d ALIAS planning_lattice_trajectory1d)



add_library(planning_end_condition_sampler 
            end_condition_sampler.cc)
target_link_libraries(planning_end_condition_sampler
    common::vehicle_config_helper
    planning::planning_gflags
    planning::feasible_region
    planning::path_time_graph
    planning::prediction_querier
    planning::proto)
add_library(planning::end_condition_sampler ALIAS planning_end_condition_sampler)





add_library(  trajectory_evaluator  
trajectory_evaluator.cc    )
target_link_libraries(  
    trajectory_evaluator
    common
    common_path_matcher
    planning::planning_gflags
    planning_piecewise_acceleration_trajectory1d

    planning_constraint_checker1d
    planning::path_time_graph
    piecewise_braking_trajectory_generator
    planning::curve1d
    
    planning_proto
)



add_library( backup_trajectory_generator 
 backup_trajectory_generator.cc     )
target_link_libraries(  backup_trajectory_generator 
common
planning::planning_gflags
planning::discretized_trajectory
planning_constant_deceleration_trajectory1d
planning_collision_checker
trajectory1d_generator
trajectory_combiner
planning::curve1d

)




add_library(  trajectory_combiner  
trajectory_combiner.cc    )
target_link_libraries(  trajectory_combiner
common
common::math
common::cartesian_frenet_conversion
common_path_matcher
planning::planning_gflags
planning::discretized_trajectory
planning::curve1d
)



add_library(  piecewise_braking_trajectory_generator
piecewise_braking_trajectory_generator.cc    )
target_link_libraries(  piecewise_braking_trajectory_generator
common
planning_piecewise_acceleration_trajectory1d
planning::curve1d

)



add_library(  lateral_qp_optimizer
lateral_qp_optimizer.cc    )
target_link_libraries( lateral_qp_optimizer 
cyber::log
planning_piecewise_jerk_trajectory1d

)






add_library(  lateral_osqp_optimizer
lateral_osqp_optimizer.cc    )
target_link_libraries(  lateral_osqp_optimizer
lateral_qp_optimizer
cyber::log
planning_piecewise_jerk_trajectory1d
Eigen3::Eigen
${osqp_LIBRARIES}

)





add_library(  trajectory1d_generator
trajectory1d_generator.cc    )
target_link_libraries(  trajectory1d_generator
planning_end_condition_sampler
lateral_osqp_optimizer
lateral_qp_optimizer
common
planning::planning_gflags
planning_constant_deceleration_trajectory1d
planning_piecewise_acceleration_trajectory1d
planning_piecewise_trajectory1d
planning_standing_still_trajectory1d
planning::path_time_graph
planning_prediction_querier
planning_lattice_trajectory1d
planning::quartic_polynomial_curve1d
planning::quintic_polynomial_curve1d
planning_proto
)




add_library(planning_lattice_trajectory_generation_module INTERFACE)
target_link_libraries(planning_lattice_trajectory_generation_module INTERFACE
    planning_lattice_trajectory1d
    planning_end_condition_sampler
    trajectory1d_generator
    trajectory_evaluator
    backup_trajectory_generator
    trajectory_combiner
    piecewise_braking_trajectory_generator
    lateral_qp_optimizer
    lateral_osqp_optimizer
    )


install(TARGETS planning_lattice_trajectory1d
                planning_end_condition_sampler
                planning_lattice_trajectory_generation_module
                trajectory1d_generator
                trajectory_evaluator
                backup_trajectory_generator
                trajectory_combiner
                piecewise_braking_trajectory_generator
                lateral_qp_optimizer
                lateral_osqp_optimizer
        EXPORT apollo-export
        LIBRARY DESTINATION lib
        ARCHIVE DESTINATION lib
        RUNTIME DESTINATION bin
        INCLUDES DESTINATION .
        )
